<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/11/22
  Time: 14:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<table border="1" width="800">
    <tr>
        <td>编号</td>
        <td>车名</td>
        <td>车型</td>
        <td>价格</td>
        <td>用户</td>
        <td></td>
    </tr>

    <c:forEach items="${pageBean.list}" var="car">
        <tr>
            <td>${car.cid}</td>
            <td>${car.cname}</td>
            <td>${car.ctype}</td>
            <td>${car.cprice}</td>
            <td>${car.cadmin}</td>
        </tr>
    </c:forEach>
    <tr>
        <td colspan="8">
            <%--1.判断是否显示上一页--%>
            <c:if test="${pageBean.currentPage!=1}">
                <a href="InquireAllCarByPage?currentPage=${pageBean.lastPage}">
                    上一页
                </a>
            </c:if>
            <%--2.显示导航的页码数字--%>
            <c:forEach begin="${pageBean.firstPage}" end="${pageBean.endPage}" var="page">
                <a href="InquireAllCarByPage?currentPage=${page}">
                        ${page}  &nbsp;
                </a>
            </c:forEach>
            <%--3.判断是否显示下一页--%>
            <c:if test="${pageBean.currentPage!=pageBean.totalPage}">
                <a href="InquireAllCarByPage?currentPage=${pageBean.nextPage}">
                    下一页
                </a>
            </c:if>
        </td>
    </tr>
</table>
</body>
</html>
